{%extends "bootstrap/base.html"%}
{%import "bootstrap/wtf.html" as wtf%}
{%block title%}学生信息管理系统{%endblock%}

{%block content%}
<div class="container">
    <div class="page-header">
        <h1>学生信息列表</h1>
        <div>
            <a href="{{ url_for('index') }}" class="btn btn-primary btn-xs">所有学生</a>
            {% for m in majors %}
            <a href="{{ url_for('filter_by_major', major_id=m.id) }}" class="btn btn-default btn-xs">{{ m.major_name }}</a>
            {% endfor %}
        </div>
    </div>
    <a class="btn btn-default" href="{{ url_for('new_stud') }}">添加学生</a>
    <h4>当前共有{{ studs|length }}名学生</h4>
    <div class="mt-3">
        {%for stud in studs%}
        <p>{{ stud.id }} {{ stud.studentName }} {{ stud.studentBirth }} 
            {%if stud.isMale%}
                男
            {%else%}
                女
            {%endif%}
            {%if stud.major%}
                <span class="label label-info">{{ stud.major.major_name }}</span>
            {%else%}
                <span class="label label-default">未分配专业</span>
            {%endif%}
        </p >
            <a class="btn btn-default" href="{{ url_for('edit_stud',id=stud.id) }}">编辑</a >
            <a class="btn btn-default" href="{{ url_for('del_stud',id=stud.id) }}">删除</a >    
        {%else%}
        <p class="text-muted">暂无学生信息</p>
        {%endfor%}
    </div>
</div>
{%endblock%}